<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>列表渲染</title>
</head>

<body>
    <div id="app">
        <ul>
            <li v-for="todo in todos" v-if="!todo.isComplete">
                {{ todo.text }}
            </li>
        </ul>

        <ul>
            <li v-for="todo in unfinishedTodos" v-if="!todo.isComplete">
                {{ todo.text }}
            </li>
        </ul>
    </div>

    <script type="module">
        import Vue from '../vue.esm.browser.js'

        const app = new Vue({
            el: '#app',
            data: {
                todos: [
                    { text: '学习 HTML', isComplete: true },
                    { text: '学习 JavaScript', isComplete: false },
                    { text: '学习 Vue', isComplete: false },
                ]
            },
            computed: {
                unfinishedTodos() {
                    return this.todos.filter(item => !item.isComplete)
                }
            }
        })
    </script>
</body>

</html>